class Solution:
    def isPalindrome(self, x: int) -> bool:
        res = []
        if x < 0:
            return False
        while x != 0:
            res.append(x % 10)
            x //= 10
        size = len(res)
        if size < 2:
            return True
        for i in range(size // 2):
            if res[i] != res[-(i+1)]:
                return False
        return True

    def isPalindrome2(self, x: int) -> bool:
        return str(x) == str(x)[::-1]


if __name__ == '__main__':
    num = 121
    s = Solution()
    print(s.isPalindrome(num))
    print(s.isPalindrome2(num))